import request from '@/utils/http.js';

export const userloginAPI = (userInfo) => {
    return request.post('/user/login', {
        ...userInfo
    })
}

export const getUserDetailAPI = () => {
    return request.get('/user/info');
}

export const registerAPI = (info) => {
    return request.post('/user/register', info);
}

export const editUserInfo = (userInfo) => {
    return request({
        url: '/user/updateUserInfo',
        method: 'POST',
        data: userInfo
    })
}

export const queryAllUserByPageAPI = ({page=1, pageSize=7, username, role}) => {
    return request({
        url: '/user/page',
        method: 'GET',
        params: {
            page,
            pageSize,
            role,
            username
        }
    })
}

export const deleteUserAPI = (userId) => {
    return request({
        url: `/user/delete/${userId}`,
        method: 'POST'
    })
}